3.1200 \(\int \frac{(c+d \tan (e+f x))^2}{a+b \tan (e+f x)} \, dx\)

Optimal. Leaf size=103 \[ \frac{(b c-a d)^2 \log (a \cos (e+f x)+b \sin (e+f x))}{b f \left (a^2+b^2\right )}+\frac{a x (b c-a d)^2}{b^2 \left (a^2+b^2\right )}+\frac{d x (2 b c-a d)}{b^2}-\frac{d^2 \log (\cos (e+f x))}{b f} \]

[Out]

(a*(b*c - a*d)^2*x)/(b^2*(a^2 + b^2)) + (d*(2*b*c - a*d)*x)/b^2 - (d^2*Log[Cos[e + f*x]])/(b*f) + ((b*c - a*d)
^2*Log[a*Cos[e + f*x] + b*Sin[e + f*x]])/(b*(a^2 + b^2)*f)

________________________________________________________________________________________

Rubi [A]  time = 0.123844, antiderivative size = 103, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 4, integrand size = 25, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.16, Rules used = {3541, 3475, 3484, 3530} \[ \frac{(b c-a d)^2 \log (a \cos (e+f x)+b \sin (e+f x))}{b f \left (a^2+b^2\right )}+\frac{a x (b c-a d)^2}{b^2 \left (a^2+b^2\right )}+\frac{d x (2 b c-a d)}{b^2}-\frac{d^2 \log (\cos (e+f x))}{b f} \]

Antiderivative was successfully verified.

[In]

Int[(c + d*Tan[e + f*x])^2/(a + b*Tan[e + f*x]),x]

[Out]

(a*(b*c - a*d)^2*x)/(b^2*(a^2 + b^2)) + (d*(2*b*c - a*d)*x)/b^2 - (d^2*Log[Cos[e + f*x]])/(b*f) + ((b*c - a*d)
^2*Log[a*Cos[e + f*x] + b*Sin[e + f*x]])/(b*(a^2 + b^2)*f)

Rule 3541

Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^2/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(d*(2
*b*c - a*d)*x)/b^2, x] + (Dist[d^2/b, Int[Tan[e + f*x], x], x] + Dist[(b*c - a*d)^2/b^2, Int[1/(a + b*Tan[e +
f*x]), x], x]) /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0]

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3484

Int[((a_) + (b_.)*tan[(c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> Simp[(a*x)/(a^2 + b^2), x] + Dist[b/(a^2 + b^2),
 Int[(b - a*Tan[c + d*x])/(a + b*Tan[c + d*x]), x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[a^2 + b^2, 0]

Rule 3530

Int[((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(c*Log[Re
moveContent[a*Cos[e + f*x] + b*Sin[e + f*x], x]])/(b*f), x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d,
0] && NeQ[a^2 + b^2, 0] && EqQ[a*c + b*d, 0]

Rubi steps

\begin{align*} \int \frac{(c+d \tan (e+f x))^2}{a+b \tan (e+f x)} \, dx &=\frac{d (2 b c-a d) x}{b^2}+\frac{d^2 \int \tan (e+f x) \, dx}{b}+\frac{(b c-a d)^2 \int \frac{1}{a+b \tan (e+f x)} \, dx}{b^2}\\ &=\frac{a (b c-a d)^2 x}{b^2 \left (a^2+b^2\right )}+\frac{d (2 b c-a d) x}{b^2}-\frac{d^2 \log (\cos (e+f x))}{b f}+\frac{(b c-a d)^2 \int \frac{b-a \tan (e+f x)}{a+b \tan (e+f x)} \, dx}{b \left (a^2+b^2\right )}\\ &=\frac{a (b c-a d)^2 x}{b^2 \left (a^2+b^2\right )}+\frac{d (2 b c-a d) x}{b^2}-\frac{d^2 \log (\cos (e+f x))}{b f}+\frac{(b c-a d)^2 \log (a \cos (e+f x)+b \sin (e+f x))}{b \left (a^2+b^2\right ) f}\\ \end{align*}

Mathematica [C]  time = 0.153347, size = 108, normalized size = 1.05 \[ \frac{\frac{2 (b c-a d)^2 \log (a+b \tan (e+f x))}{b \left (a^2+b^2\right )}-\frac{(c-i d)^2 \log (\tan (e+f x)+i)}{b+i a}+\frac{(c+i d)^2 \log (-\tan (e+f x)+i)}{-b+i a}}{2 f} \]

Antiderivative was successfully verified.

[In]

Integrate[(c + d*Tan[e + f*x])^2/(a + b*Tan[e + f*x]),x]

[Out]

(((c + I*d)^2*Log[I - Tan[e + f*x]])/(I*a - b) - ((c - I*d)^2*Log[I + Tan[e + f*x]])/(I*a + b) + (2*(b*c - a*d
)^2*Log[a + b*Tan[e + f*x]])/(b*(a^2 + b^2)))/(2*f)

________________________________________________________________________________________

Maple [B]  time = 0.023, size = 249, normalized size = 2.4 \begin{align*}{\frac{\ln \left ( 1+ \left ( \tan \left ( fx+e \right ) \right ) ^{2} \right ) acd}{f \left ({a}^{2}+{b}^{2} \right ) }}-{\frac{\ln \left ( 1+ \left ( \tan \left ( fx+e \right ) \right ) ^{2} \right ) b{c}^{2}}{2\,f \left ({a}^{2}+{b}^{2} \right ) }}+{\frac{\ln \left ( 1+ \left ( \tan \left ( fx+e \right ) \right ) ^{2} \right ) b{d}^{2}}{2\,f \left ({a}^{2}+{b}^{2} \right ) }}+{\frac{\arctan \left ( \tan \left ( fx+e \right ) \right ) a{c}^{2}}{f \left ({a}^{2}+{b}^{2} \right ) }}-{\frac{\arctan \left ( \tan \left ( fx+e \right ) \right ) a{d}^{2}}{f \left ({a}^{2}+{b}^{2} \right ) }}+2\,{\frac{\arctan \left ( \tan \left ( fx+e \right ) \right ) bcd}{f \left ({a}^{2}+{b}^{2} \right ) }}+{\frac{\ln \left ( a+b\tan \left ( fx+e \right ) \right ){a}^{2}{d}^{2}}{f \left ({a}^{2}+{b}^{2} \right ) b}}-2\,{\frac{\ln \left ( a+b\tan \left ( fx+e \right ) \right ) acd}{f \left ({a}^{2}+{b}^{2} \right ) }}+{\frac{b\ln \left ( a+b\tan \left ( fx+e \right ) \right ){c}^{2}}{f \left ({a}^{2}+{b}^{2} \right ) }} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((c+d*tan(f*x+e))^2/(a+b*tan(f*x+e)),x)

[Out]

1/f/(a^2+b^2)*ln(1+tan(f*x+e)^2)*a*c*d-1/2/f/(a^2+b^2)*ln(1+tan(f*x+e)^2)*b*c^2+1/2/f/(a^2+b^2)*ln(1+tan(f*x+e
)^2)*b*d^2+1/f/(a^2+b^2)*arctan(tan(f*x+e))*a*c^2-1/f/(a^2+b^2)*arctan(tan(f*x+e))*a*d^2+2/f/(a^2+b^2)*arctan(
tan(f*x+e))*b*c*d+1/f/(a^2+b^2)/b*ln(a+b*tan(f*x+e))*a^2*d^2-2/f/(a^2+b^2)*ln(a+b*tan(f*x+e))*a*c*d+1/f/(a^2+b
^2)*b*ln(a+b*tan(f*x+e))*c^2

________________________________________________________________________________________

Maxima [A]  time = 1.68731, size = 166, normalized size = 1.61 \begin{align*} \frac{\frac{2 \,{\left (a c^{2} + 2 \, b c d - a d^{2}\right )}{\left (f x + e\right )}}{a^{2} + b^{2}} + \frac{2 \,{\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \log \left (b \tan \left (f x + e\right ) + a\right )}{a^{2} b + b^{3}} - \frac{{\left (b c^{2} - 2 \, a c d - b d^{2}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{a^{2} + b^{2}}}{2 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*tan(f*x+e))^2/(a+b*tan(f*x+e)),x, algorithm="maxima")

[Out]

1/2*(2*(a*c^2 + 2*b*c*d - a*d^2)*(f*x + e)/(a^2 + b^2) + 2*(b^2*c^2 - 2*a*b*c*d + a^2*d^2)*log(b*tan(f*x + e)
+ a)/(a^2*b + b^3) - (b*c^2 - 2*a*c*d - b*d^2)*log(tan(f*x + e)^2 + 1)/(a^2 + b^2))/f

________________________________________________________________________________________

Fricas [A]  time = 1.55674, size = 294, normalized size = 2.85 \begin{align*} -\frac{{\left (a^{2} + b^{2}\right )} d^{2} \log \left (\frac{1}{\tan \left (f x + e\right )^{2} + 1}\right ) - 2 \,{\left (a b c^{2} + 2 \, b^{2} c d - a b d^{2}\right )} f x -{\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \log \left (\frac{b^{2} \tan \left (f x + e\right )^{2} + 2 \, a b \tan \left (f x + e\right ) + a^{2}}{\tan \left (f x + e\right )^{2} + 1}\right )}{2 \,{\left (a^{2} b + b^{3}\right )} f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*tan(f*x+e))^2/(a+b*tan(f*x+e)),x, algorithm="fricas")

[Out]

-1/2*((a^2 + b^2)*d^2*log(1/(tan(f*x + e)^2 + 1)) - 2*(a*b*c^2 + 2*b^2*c*d - a*b*d^2)*f*x - (b^2*c^2 - 2*a*b*c
*d + a^2*d^2)*log((b^2*tan(f*x + e)^2 + 2*a*b*tan(f*x + e) + a^2)/(tan(f*x + e)^2 + 1)))/((a^2*b + b^3)*f)

________________________________________________________________________________________

Sympy [A]  time = 4.91538, size = 1025, normalized size = 9.95 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*tan(f*x+e))**2/(a+b*tan(f*x+e)),x)

[Out]

Piecewise((zoo*x*(c + d*tan(e))**2/tan(e), Eq(a, 0) & Eq(b, 0) & Eq(f, 0)), (-I*c**2*f*x*tan(e + f*x)/(-2*b*f*
tan(e + f*x) + 2*I*b*f) - c**2*f*x/(-2*b*f*tan(e + f*x) + 2*I*b*f) - I*c**2/(-2*b*f*tan(e + f*x) + 2*I*b*f) -
2*c*d*f*x*tan(e + f*x)/(-2*b*f*tan(e + f*x) + 2*I*b*f) + 2*I*c*d*f*x/(-2*b*f*tan(e + f*x) + 2*I*b*f) + 2*c*d/(
-2*b*f*tan(e + f*x) + 2*I*b*f) - I*d**2*f*x*tan(e + f*x)/(-2*b*f*tan(e + f*x) + 2*I*b*f) - d**2*f*x/(-2*b*f*ta
n(e + f*x) + 2*I*b*f) - d**2*log(tan(e + f*x)**2 + 1)*tan(e + f*x)/(-2*b*f*tan(e + f*x) + 2*I*b*f) + I*d**2*lo
g(tan(e + f*x)**2 + 1)/(-2*b*f*tan(e + f*x) + 2*I*b*f) + I*d**2/(-2*b*f*tan(e + f*x) + 2*I*b*f), Eq(a, -I*b)),
 (-I*c**2*f*x*tan(e + f*x)/(2*b*f*tan(e + f*x) + 2*I*b*f) + c**2*f*x/(2*b*f*tan(e + f*x) + 2*I*b*f) - I*c**2/(
2*b*f*tan(e + f*x) + 2*I*b*f) + 2*c*d*f*x*tan(e + f*x)/(2*b*f*tan(e + f*x) + 2*I*b*f) + 2*I*c*d*f*x/(2*b*f*tan
(e + f*x) + 2*I*b*f) - 2*c*d/(2*b*f*tan(e + f*x) + 2*I*b*f) - I*d**2*f*x*tan(e + f*x)/(2*b*f*tan(e + f*x) + 2*
I*b*f) + d**2*f*x/(2*b*f*tan(e + f*x) + 2*I*b*f) + d**2*log(tan(e + f*x)**2 + 1)*tan(e + f*x)/(2*b*f*tan(e + f
*x) + 2*I*b*f) + I*d**2*log(tan(e + f*x)**2 + 1)/(2*b*f*tan(e + f*x) + 2*I*b*f) + I*d**2/(2*b*f*tan(e + f*x) +
 2*I*b*f), Eq(a, I*b)), ((c**2*x + c*d*log(tan(e + f*x)**2 + 1)/f - d**2*x + d**2*tan(e + f*x)/f)/a, Eq(b, 0))
, (x*(c + d*tan(e))**2/(a + b*tan(e)), Eq(f, 0)), (2*a**2*d**2*log(a/b + tan(e + f*x))/(2*a**2*b*f + 2*b**3*f)
 + 2*a*b*c**2*f*x/(2*a**2*b*f + 2*b**3*f) - 4*a*b*c*d*log(a/b + tan(e + f*x))/(2*a**2*b*f + 2*b**3*f) + 2*a*b*
c*d*log(tan(e + f*x)**2 + 1)/(2*a**2*b*f + 2*b**3*f) - 2*a*b*d**2*f*x/(2*a**2*b*f + 2*b**3*f) + 2*b**2*c**2*lo
g(a/b + tan(e + f*x))/(2*a**2*b*f + 2*b**3*f) - b**2*c**2*log(tan(e + f*x)**2 + 1)/(2*a**2*b*f + 2*b**3*f) + 4
*b**2*c*d*f*x/(2*a**2*b*f + 2*b**3*f) + b**2*d**2*log(tan(e + f*x)**2 + 1)/(2*a**2*b*f + 2*b**3*f), True))

________________________________________________________________________________________

Giac [A]  time = 1.45284, size = 171, normalized size = 1.66 \begin{align*} \frac{\frac{2 \,{\left (a c^{2} + 2 \, b c d - a d^{2}\right )}{\left (f x + e\right )}}{a^{2} + b^{2}} - \frac{{\left (b c^{2} - 2 \, a c d - b d^{2}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{a^{2} + b^{2}} + \frac{2 \,{\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \log \left ({\left | b \tan \left (f x + e\right ) + a \right |}\right )}{a^{2} b + b^{3}}}{2 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*tan(f*x+e))^2/(a+b*tan(f*x+e)),x, algorithm="giac")

[Out]

1/2*(2*(a*c^2 + 2*b*c*d - a*d^2)*(f*x + e)/(a^2 + b^2) - (b*c^2 - 2*a*c*d - b*d^2)*log(tan(f*x + e)^2 + 1)/(a^
2 + b^2) + 2*(b^2*c^2 - 2*a*b*c*d + a^2*d^2)*log(abs(b*tan(f*x + e) + a))/(a^2*b + b^3))/f